﻿<%@ Page Title="Employees" Language="C#" MasterPageFile="~/TableMaster.master" AutoEventWireup="true" CodeFile="Employees.aspx.cs" Inherits="admin_Employees" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <style>
        @media only screen and (max-width: 760px), (min-device-width: 768px) and (max-device-width: 1024px) {

            .resTbl tr:nth-of-type(odd) {
                background-color: #CDE2FF;
            }

            .resTbl tr:nth-of-type(1) {
                display: none;
            }

            .resTbl td:nth-of-type(1):before {
                content: "User Code";
            }

            .resTbl td:nth-of-type(2):before {
                content: "User Role";
            }

            .resTbl td:nth-of-type(3):before {
                content: "First Name";
            }

            .resTbl td:nth-of-type(4):before {
                content: "Last Name";
            }

            .resTbl td:nth-of-type(5):before {
                content: "Department Name";
            }

            .resTbl td:nth-of-type(6):before {
                content: "Designation Name";
            }

            .resTbl td:nth-of-type(7):before {
                content: "Created By";
            }

            .resTbl td:nth-of-type(8):before {
                content: "Created Date";
            }
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="FeaturedContent" runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="Add" runat="Server">

    <asp:Panel ID="pnlAdd" runat="server">

        <table cellpadding="0" cellspacing="0" style="width: 100%;">

            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblUSER_CODE" runat="server" AssociatedControlID="ddlUSER_CODE" Text="User Code:"></asp:Label>
                </td>
                <td>
                    <asp:DropDownList ID="ddlUSER_CODE" runat="server" AppendDataBoundItems="True" DataSourceID="DS_UserCode" DataTextField="USER_NAME" DataValueField="USER_NAME" EnableViewState="false">
                        <asp:ListItem Text="--Select--" Value="0"></asp:ListItem>
                    </asp:DropDownList>
                    <asp:ObjectDataSource ID="DS_UserCode" runat="server" SelectMethod="selectAll" TypeName="DAL_tbl_users"></asp:ObjectDataSource>
                </td>
            </tr>

            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblUSER_ROLE_ID" runat="server" AssociatedControlID="ddlUSER_ROLE_ID" Text="User Role Id:"></asp:Label>
                </td>
                <td>
                    <asp:DropDownList ID="ddlUSER_ROLE_ID" runat="server" AppendDataBoundItems="True" DataSourceID="DS_Roles" DataTextField="ROLE_NAME" DataValueField="ROLE_ID" EnableViewState="false">
                        <asp:ListItem Text="--Select--" Value="0"></asp:ListItem>
                    </asp:DropDownList>
                    <asp:ObjectDataSource ID="DS_Roles" runat="server" SelectMethod="selectAll" TypeName="DAL_tbl_role_master"></asp:ObjectDataSource>
                </td>
            </tr>

            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblFIRST_NAME" runat="server" AssociatedControlID="txtFIRST_NAME" Text="First Name:"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtFIRST_NAME" runat="server"></asp:TextBox>
                </td>
            </tr>

            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblLAST_NAME" runat="server" AssociatedControlID="txtLAST_NAME" Text="Last Name:"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="txtLAST_NAME" runat="server"></asp:TextBox>
                </td>
            </tr>

            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblDEPARTMENT_ID" runat="server" AssociatedControlID="ddlDEPARTMENT_ID" Text="Department Id:"></asp:Label>
                </td>
                <td>
                    <asp:DropDownList ID="ddlDEPARTMENT_ID" runat="server" AppendDataBoundItems="True" DataSourceID="DS_Departments" DataTextField="DEPARTMENT_NAME" DataValueField="DEPARTMENT_ID" EnableViewState="false">
                        <asp:ListItem Text="--Select--" Value="0"></asp:ListItem>
                    </asp:DropDownList>
                    <asp:ObjectDataSource ID="DS_Departments" runat="server" SelectMethod="selectAll" TypeName="DAL_tbl_department_master"></asp:ObjectDataSource>
                </td>
            </tr>

            <tr>
                <td style="width: 170px">
                    <asp:Label ID="lblDESIGNATION_ID" runat="server" AssociatedControlID="ddlDESIGNATION_ID" Text="Designation Id:"></asp:Label>
                </td>
                <td>
                    <asp:DropDownList ID="ddlDESIGNATION_ID" runat="server" AppendDataBoundItems="True" DataSourceID="DS_Designations" DataTextField="DESIGNATION_NAME" DataValueField="DESIGNATION_ID" EnableViewState="false">
                        <asp:ListItem Text="--Select--" Value="0"></asp:ListItem>
                    </asp:DropDownList>
                    <asp:ObjectDataSource ID="DS_Designations" runat="server" SelectMethod="selectAll" TypeName="DAL_tbl_designation_master"></asp:ObjectDataSource>
                </td>
            </tr>

            <tr>
                <td style="width: 170px">&nbsp;</td>
                <td>

                    <asp:Button ID="btnSave" runat="server" CssClass="btn btn-success" OnClick="btnSave_Click" Text="Save" Width="90px" />
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <asp:Button ID="btnCancel" runat="server" CssClass="btn btn-danger" OnClick="btnCancel_Click" Text="Cancel" Width="90px" />

                </td>
            </tr>

        </table>

    </asp:Panel>

</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="Grid" runat="Server">
    <asp:Panel ID="pnlList" runat="server">
        <asp:GridView ID="gridClients" runat="server" AutoGenerateColumns="False" CssClass="resTbl" DataSourceID="DS_tbl_employee_master">
            <Columns>
                <asp:BoundField DataField="USER_CODE" HeaderText="User Code" SortExpression="USER_CODE" />
                <asp:BoundField DataField="USER_ROLE_ID" HeaderText="User Role" SortExpression="USER_ROLE_ID" />
                <asp:BoundField DataField="FIRST_NAME" HeaderText="First Name" SortExpression="FIRST_NAME" />
                <asp:BoundField DataField="LAST_NAME" HeaderText="Last Name" SortExpression="LAST_NAME" />
                <asp:BoundField DataField="DEPARTMENT_ID" HeaderText="Department Name" SortExpression="DEPARTMENT_ID" />
                <asp:BoundField DataField="DESIGNATION_ID" HeaderText="Designation Name" SortExpression="DESIGNATION_ID" />
                <asp:BoundField DataField="CREATED_BY" HeaderText="Created By" SortExpression="CREATED_BY" />
                <asp:BoundField DataField="CREATED_DATE" HeaderText="Created Date" SortExpression="CREATED_DATE" DataFormatString="{0:yyMMdd}" />

                <asp:TemplateField HeaderText="Edit">
                    <ItemTemplate>
                        <asp:LinkButton ID="linkEdit" runat="server" Text="Edit" CommandArgument='<%# Eval("USER_CODE") %>' OnClick="linkEdit_Click"></asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Delete">
                    <ItemTemplate>
                        <asp:LinkButton ID="linkDelete" CommandName="delete" runat="server" Text="Delete" OnClientClick="javascript:return confirm('Are you sure you want to delete this record?');" CommandArgument='<%# Eval("USER_CODE") %>' OnClick="linkDelete_Click"></asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
        <asp:ObjectDataSource ID="DS_tbl_employee_master" runat="server" SelectMethod="selectAllForGrid" DeleteMethod="delete" InsertMethod="insert" UpdateMethod="update" TypeName="DAL_tbl_employee_master">
            <DeleteParameters>
                <asp:Parameter Name="USER_CODE" Type="String" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="USER_CODE" Type="String" />
                <asp:Parameter Name="USER_ROLE_ID" Type="Int32" />
                <asp:Parameter Name="FIRST_NAME" Type="String" />
                <asp:Parameter Name="LAST_NAME" Type="String" />
                <asp:Parameter Name="DEPARTMENT_ID" Type="Int32" />
                <asp:Parameter Name="DESIGNATION_ID" Type="Int32" />
                <asp:Parameter Name="CREATED_BY" Type="String" />
                <asp:Parameter Name="CREATED_DATE" Type="DateTime" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="USER_CODE" Type="String" />
                <asp:Parameter Name="USER_ROLE_ID" Type="Int32" />
                <asp:Parameter Name="FIRST_NAME" Type="String" />
                <asp:Parameter Name="LAST_NAME" Type="String" />
                <asp:Parameter Name="DEPARTMENT_ID" Type="Int32" />
                <asp:Parameter Name="DESIGNATION_ID" Type="Int32" />
                <asp:Parameter Name="UPDATED_BY" Type="String" />
                <asp:Parameter Name="UPDATED_DATE" Type="DateTime" />
            </UpdateParameters>
        </asp:ObjectDataSource>
    </asp:Panel>
</asp:Content>

